package com.joysuch.wwyt.workflow.enums;

/**
 * @Author ZhaoQiuWei
 * @Date 2021/4/16 13:54
 * 报表统计_数据来源
 */
public enum WorkFlowDataSourceEnum {

    WORK_FLOW("work_flow", "业务流程");

    private String code;
    private String name;

    private WorkFlowDataSourceEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public boolean is(String code) {
        return this.code.equals(code);
    }

    public static WorkFlowDataSourceEnum findByCode(String code) {
        if (code == null) {
            return null;
        }
        for (WorkFlowDataSourceEnum m : WorkFlowDataSourceEnum.values()) {
            if (m.code.equals(code)) {
                return m;
            }
        }
        return null;
    }

    public static String findNameByCode(String code) {
        WorkFlowDataSourceEnum m = findByCode(code);
        return m == null ? null : m.getName();
    }
}
